package generice;

public class Demo1 {
    public static void main(String[] args) {
        Transferobject o=new Transferobject();
        o.setSender("王克晶");
        o.setReceiver("范长奇");
        o.setData("您好");
        o.setData(123);//自动装箱(Integer.valueof;)

        Transferobject<String> o1= new Transferobject<>();
         //   o1.setData(123);
        o1.setData("nihao");

        Transferobject<Integer> o2=new Transferobject<>();
        o2.setData(123);//会自动装箱
        //o2.setData("ninhao");

        //如果没指定泛型
        //Object d=o.getData();
        String s=(String)o.getData();

        //o1实例化时指定的泛型为String类型
        String s1= o1.getData();
        Integer i= o2.getData();



    }
}
